<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<script type="text/javascript">
			var generate = function(numRows) {
			    const ret = [];
			    for (let i = 0; i < numRows; i++) {
			        const row = new Array(i + 1).fill(1);
			        for (let j = 1; j < row.length - 1; j++) {
			            row[j] = ret[i - 1][j - 1] + ret[i - 1][j];
			        }
			        ret.push(row);
			    }
			    return ret;
			};
			console.log(generate(5));
		</script>
	</body>
</html>
